package airplane.obj;

import airplane.war.GameWin;

import java.awt.*;

public class BgObj extends GameObj{
    public BgObj(Image imag, int x, int y, int width, int height, int speed) {
        super(imag, x, y, width, height, speed);
    }

    public BgObj(Image imag, int x, int y, int width, int height, int speed, GameWin gameWin) {
        super(imag, x, y, width, height, speed, gameWin);
    }

    public BgObj(Image imag, int x, int y, int speed) {
        super(imag, x, y, speed);
    }

    @Override
    public void paintSelf(Graphics graphics) {
        super.paintSelf(graphics);
        y += speed;
        // 如果移动超出了图片，则恢复背景图片的位置
        if (y >= 0) {
            y = -2000;
        }
    }
}
